\mode<presentation>

\RequirePackage{tikz}

\defbeamertemplate*{frametitle}{sjtu}
{%
  \nointerlineskip%
  \begin{beamercolorbox}[wd=\paperwidth, ht=1.2cm]{empty}
    \usebeamercolor{frametitle}% 
    \begin{tikzpicture}
      \pgfmathsetlengthmacro{\outslant}{\the\paperwidth - 0.5cm}
      \fill[bg] (0,0) -- (\outslant,0) -- (\the\paperwidth,1.2) -- (0,1.2) -- cycle;
      \node[anchor=center, inner sep=0, outer sep=0] (logo) at (0.6,0.6){\insertlogo};
      \ifx\insertframesubtitle\@empty%
          {\node[anchor=west, fg, font=\large] at (1.3,0.61){\insertframetitle};}%
      \else%
          {\node[anchor=west, fg, font=\large] at (1.3,0.81){\insertframetitle};%
           \node[anchor=west, fg, font=\small] at (1.3,0.31){\insertframesubtitle};}%
      \fi
    \end{tikzpicture}
  \end{beamercolorbox}
}

\defbeamertemplate*{sidebar right}{sjtu}
{%
  \vfill%
  \llap{\usebeamertemplate***{navigation symbols}\hskip0.1cm}%
  \vskip2pt%
}

\mode<all>
